package yunwo.cn.yzstation.view.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import java.util.ArrayList;
import java.util.List;

import yunwo.cn.yzstation.R;
import yunwo.cn.yzstation.adapter.SchedulingVPAdapter;
import yunwo.cn.yzstation.base.MyBaseActivity;
import yunwo.cn.yzstation.view.fregment.schedulingcar.HistoryFragment;
import yunwo.cn.yzstation.view.fregment.schedulingcar.SchedulingFragment;

/**
 * Created by lao on 2017/9/1.
 */
public class SchedulingActivity extends MyBaseActivity{
    private TabLayout mSchedulingTab;
    private ViewPager mSchedulingVp;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initEvent();
    }

    private void initEvent() {
        List<Fragment> list = new ArrayList<>();
        list.add(new SchedulingFragment());
        list.add(new HistoryFragment());
        SchedulingVPAdapter schedulingVPAdapter = new SchedulingVPAdapter(getSupportFragmentManager(), list);
        mSchedulingVp.setAdapter(schedulingVPAdapter);
        mSchedulingTab.setupWithViewPager(mSchedulingVp);
    }

    private void initView() {

        mSchedulingTab = (TabLayout) findViewById(R.id.scheduling_tab);
        mSchedulingVp = (ViewPager) findViewById(R.id.scheduling_vp);

    }

    @Override
    protected String settiltile() {
        return "车次列表";
    }

    @Override
    protected int getLayoutRsid() {
        return R.layout.activity_scheduling;
    }
}
